package com.lc.cehui.ui.activity;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.donkingliang.labels.LabelsView;
import com.hjq.bar.OnTitleBarListener;
import com.hjq.bar.TitleBar;
import com.lc.cehui.R;
import com.lc.cehui.app.AppActivity;
import com.lc.cehui.ui.activity.home.ParticularsDetailsActivity;
import com.lc.cehui.http.response.BaseBean;
import com.scwang.smart.refresh.header.MaterialHeader;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/*面试日程*/
public class InterviewScheduleActivity extends AppActivity {

    @BindView(R.id.titleBar)
    TitleBar titleBar;
    @BindView(R.id.recyclerView)
    RecyclerView recyclerView;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout refreshLayout;
    private BaseQuickAdapter adapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_interview_schedule;
    }

    @Override
    protected void initView() {
        titleBar.setOnTitleBarListener(new OnTitleBarListener() {
            @Override
            public void onLeftClick(View v) {
                finish();
            }

            @Override
            public void onTitleClick(View v) {

            }

            @Override
            public void onRightClick(View v) {
                startActivity(InterviewRecordActivity.class);
            }
        });
        refreshLayout.setRefreshHeader(new MaterialHeader(getContext()));
        refreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(@NonNull RefreshLayout refreshLayout) {
                refreshLayout.finishRefresh();
            }
        });
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.setAdapter(adapter = new BaseQuickAdapter<BaseBean, BaseViewHolder>(R.layout.adapter_interview_schedule) {
            @Override
            protected void convert(@NonNull BaseViewHolder baseViewHolder, BaseBean dataBean) {

            }
        });
        adapter.setOnItemClickListener(new OnItemClickListener() {
            @Override
            public void onItemClick(@NonNull BaseQuickAdapter<?, ?> adapter, @NonNull View view, int position) {
                startActivity(InterviewNotesActivity.class);
            }
        });
    }

    @Override
    protected void initData() {
        List<BaseBean> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            list.add(new BaseBean());
        }
        adapter.setNewInstance(list);
        adapter.notifyDataSetChanged();
    }

}